package com.own.demo.长沙空中路网格子.Thread;

import org.locationtech.jts.geom.Coordinate;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;

/**
 * 线程启用接口
 *
 * @author heguanglong
 * @date 2023/6/13
 */
public class ALLThread2 implements Runnable {
    private ConcurrentHashMap<String,Long> allMap;
    private Coordinate coordinateA;
    private List<Coordinate> allPoints;
    public ALLThread2( ConcurrentHashMap<String,Long> allMap, Coordinate coordinateA, List<Coordinate> allPoints) {
        this.allMap=allMap;
        this.coordinateA=coordinateA;
        this.allPoints=allPoints;
    }

    @Override
    public void run() {
        try {
            Coordinate coordinateIn=  new Coordinate( coordinateA.x,coordinateA.y);
            String key=coordinateIn.x+"_"+coordinateIn.y;
            if(!allMap.containsKey(key)) {
                allPoints.add(coordinateIn);
                allMap.put(key,1L);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
